package com.feicheng.house.controller.customer;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.feicheng.house.entity.BuyOrder;
import com.feicheng.house.result.ResultInfo;
import com.feicheng.house.service.IBuyOrderService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author feichengTech
 * @since 2021-11-25
 */
@RestController
@RequestMapping("/customer/buy-order")
public class CustomerBuyOrderController {
	@Autowired
	IBuyOrderService iBuyOrderService;
	/**
	 * 新增订单
	 * @param buyOrder
	 * @return Boolean值
	 */
	@PostMapping("/info")
	ResultInfo addOne(BuyOrder buyOrder) {
		return iBuyOrderService.addOne(buyOrder);
	}
	/**
	 * 修改订单
	 * @param buyOrderNmber
	 * @return Boolean值
	 */
	@PutMapping("/info")
	public ResultInfo updateOne(BuyOrder buyOrder) {
				
		return iBuyOrderService.updateOne(buyOrder);
	}
	/**
	 * 判断是否是新用户,根据clientId查询客户的订单数量，大于0不是新用户
	 * @param clientId
	 * @return buyOrder
	 */
	@GetMapping("/info")
	public ResultInfo getCount(Integer clientId) {
		
		return iBuyOrderService.getCount(clientId);
	}
}

